package com.teyao.teyao_back.service.impl;


import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.teyao.teyao_back.entity.Loading;
import com.teyao.teyao_back.entity.ResponseMessage;
import com.teyao.teyao_back.mapper.LoadingMapper;
import com.teyao.teyao_back.service.LoadingService;
import org.springframework.stereotype.Service;

@Service
public class LoadingImpl extends ServiceImpl<LoadingMapper, Loading> implements LoadingService {

    @Override
    public ResponseMessage updateByOrderId(String orderId, Loading loading) {
        ResponseMessage responseMessage = new ResponseMessage();
        UpdateWrapper<Loading> updateWrapper = new UpdateWrapper<>();
        updateWrapper.eq("order_id", orderId);
        boolean success = baseMapper.update(loading, updateWrapper) > 0 ? true : false;
        responseMessage.setSuccess(success);
        return responseMessage;
    }
}
